<?php


// +----------------------------------------------------------------------
// | LuluCWS [ Lulu COMPANY WEB SHOW]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://www.luluui.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: uuleaf <uuleaf@163.com>
// +----------------------------------------------------------------------
class MemberModel extends IrelaModel {
	//完整文字member_id username email password role_id created question answer status oid
	//完整文字member_id realname sex msn tel address qq birth fax postcode mobile pic 	work 	detail 
	public function _filter() {
		$this->cmap['r'] = true;
	}
	/**
	 +----------------------------------------------------------
	 * 关联设置
	 +----------------------------------------------------------
	 * @access public
	 +----------------------------------------------------------
	 * @param none
	 +----------------------------------------------------------
	 * @return none
	 +----------------------------------------------------------
	 * @throws none
	 +----------------------------------------------------------
	 */
	protected $_link = array (
		'content' => array (
			'mapping_type' => HAS_ONE,
			'class_name' => 'Member_content',
			'foreign_key' => 'member_id',
		),
		'orderform' => array (
			'mapping_type' => HAS_MANY,
			'class_name' => 'Orderform',
			'foreign_key' => 'member_id',
			'mapping_name' => 'orderform',
		)
	);
	/**
	 +----------------------------------------------------------
	 * 字段设置数组
	 +----------------------------------------------------------
	 * @access public
	 +----------------------------------------------------------
	 * @param none
	 +----------------------------------------------------------
	 * @return none
	 * '字段名称' => array();
	 * t 字体类型 ：input text function select relation
	 * v 默认值
	 +----------------------------------------------------------
	 * @throws ThinkExecption
	 +----------------------------------------------------------
	 */
	public $fields_set = array (
		'member_id' => array (
			't' => 'input',
			'v' => 0
		),
		'unioner_id' => array (
			't' => 'input',
			'v' => 0
		),
		'union' => array (
			't' => 'input',
			'v' => 0
		),
		'username' => array (
			't' => 'input',
			'v' => ''
		),
		'email' => array (
			't' => 'input',
			'v' => ''
		),
		'password' => array (
			't' => 'input',
			'v' => ''
		),
		'role_id' => array (
			't' => 'input',
			'v' => ''
		),
		'last_ip' => array (
			't' => 'input',
			'v' => ''
		),
		'last_visit' => array (
			't' => 'input',
			'v' => ''
		),
		'created' => array (
			't' => 'function',
			'v' => 'time'
		),
		'question' => array (
			't' => 'input',
			'v' => ''
		),
		'answer' => array (
			't' => 'input',
			'v' => ''
		),
		'status' => array (
			't' => 'select',
			'v' => 1
		),
		'oid' => array (
			't' => 'input',
			'v' => ''
		),
		'content' => array (
			't' => 'relation',
			'v' => array (
				'member_id' => array (
					't' => 'input',
					'v' => ''
				),
				'realname' => array (
					't' => 'input',
					'v' => ''
				),
				'sex' => array (
					't' => 'input',
					'v' => ''
				),
				'tel' => array (
					't' => 'input',
					'v' => ''
				),
				'msn' => array (
					't' => 'input',
					'v' => ''
				),
				'address ' => array (
					't' => 'input',
					'v' => ''
				),
				'qq' => array (
					't' => 'text',
					'v' => ''
				),
				'birth' => array (
					't' => 'input',
					'v' => ''
				),
				'fax' => array (
					't' => 'input',
					'v' => ''
				),
				'postcode' => array (
					't' => 'input',
					'v' => ''
				),
				'mobile' => array (
					't' => 'select',
					'v' => ''
				),
				'pic' => array (
					't' => 'select',
					'v' => ''
				),
				'paycode' => array (
					't' => 'input',
					'v' => ''
				),
				'detail' => array (
					't' => 'select',
					'v' => ''
				),
			),
		)
	);

	/**
	 +----------------------------------------------------------
	 * 自动验证
	 +----------------------------------------------------------
	 * @access protected
	 +----------------------------------------------------------
	 * @param none
	 +----------------------------------------------------------
	 * @return none
	 +----------------------------------------------------------
	 * @throws none
	 +----------------------------------------------------------
	 */
	protected $_validate = array ();
	/**
	 +----------------------------------------------------------
	 * 自动填充
	 +----------------------------------------------------------
	 * @access protected
	 +----------------------------------------------------------
	 * @param none
	 +----------------------------------------------------------
	 * @return none
	 +----------------------------------------------------------
	 * @throws none
	 +----------------------------------------------------------
	 */
	protected $_auto = array (
		array (
			'status',
			'1'
		),
		// 新增的时候把status字段设置为1
	array (
			'created',
			'time',
			1,
			'function'
		)
		// 对create_time字段在更新的时候写入当前时间戳	

	
	);
	public function del() {
		$this->relationmark = true;
		parent :: del();
	}
}
?>